package cn.edu.suda.schoolBus.util;

import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ResultUtil {

	public static Map<String, Boolean> getResult(int i) {
		Map<String, Boolean> map = new HashMap<>();
		if (i > 0) {
			map.put("flag", true);
		} else {
			map.put("flag", false);
		}
		return map;
	}

	public static List<Integer> getResult(String ids) {
		String[] strings = ids.split(",");
		Integer[] integers = new Integer[strings.length];
		for (int i = 0; i < strings.length; i++) {
			integers[i] = Integer.parseInt(strings[i]);
		}
		return Arrays.asList(integers);
	}

	public static Date getDate(int days) {
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(new Date());
		calendar.add(Calendar.DAY_OF_YEAR, -days);
		return calendar.getTime();
	}

}
